#include <vector>
#include <stdexcept>
#include "grade.h"
#include "median.h"

using namespace std;

//TODO
double grade(double midterm, double final, double homework){
    return 0.2*midterm + 0.4*final + 0.4*homework;
}
double grade(double midterm, double final, const std::vector<double> & hw){
    
    double avg = average(hw);
    double med = median(hw);
    return grade(midterm, final, 0.6*avg + 0.4*med);
}
double grade(const Student_info &s){
    return grade(s.midterm,s.final,s.homework);
}

bool fgrade(const Student_info &s){
    return grade(s)<60;
}
